package pl.edu.agh.inpema.core.model;

public class Profile implements Comparable<Profile> {

	private int profileId;
	private String receiverName;
	private String value;
	
	public Profile(String receiverName, String value, int profileId) {
		this.receiverName = receiverName;
		this.value = value;
		this.profileId = profileId;
	}
	
	public Profile(String receiverName, String value) {
		this.receiverName = receiverName;
		this.value = value;
	}
	
	public Profile() {
		
	}

	public int getProfileId() {
		return profileId;
	}
	public void setProfileId(int profileId) {
		this.profileId = profileId;
	}
	public String getReceiverName() {
		return receiverName;
	}
	public void setReceiverName(String receiverName) {
		this.receiverName = receiverName;
	}
	public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	
	public int compareTo(Profile p) {
		//int reciversComparation = this.receiverName.compareTo(p.getReceiverName());
		//if (reciversComparation == 0)
			return this.value.compareTo(p.getValue());
		//else
		//	return reciversComparation;
	}
	
	public boolean equals(Object o) {
		Profile p = (Profile) o;
		if (this.profileId != p.getProfileId())
			return false;
		if (! this.receiverName.equals(p.getReceiverName()))
			return false;
		if (! this.value.equals(p.getValue()))
			return false;
		return true;
	}
	
	public int hashCode() {
		return this.profileId + this.receiverName.hashCode() + this.value.hashCode();
	}
	
	public String toString() {
		//return this.receiverName + ":" + this.value;
		return this.value;
	}
}
